package com.snail.common.core;

import com.snail.common.entity.Page;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.NoRepositoryBean;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * @param <T>
 * @param <ID>
 * @author houyanfeng 2018年2月27日
 */
@NoRepositoryBean
public interface BaseRepository<T, ID extends Serializable> extends JpaRepository<T, ID>, JpaSpecificationExecutor<T> {

    public List<Map<String, Object>> execSql(String sql);

    public List<Map<String, Object>> execSql(String sql, Object[] objects);

    public Page execSqlPage(Page page, String sql);

    public List<T> execHql(String hql);

    public List<T> execHql(String hql, Object[] objects);

    public List<T> execHql(String hql, Map<String, Object> params);

    public Page execHqlPage(Page page, String hql);

}